const dayjs = require("dayjs");
const express = require("express");

const App = express();

App.get("/students", (req, res) => {
    console.log("5001服务器接收到1个请求");
    res.setHeader("Content-Type", "application/json;charset=utf8");
    let result = [
        {
            name: "徐虎",
            age: 22,
            date: dayjs().format("YYYY-MM-DD HH:mm:ss"),
        },
        {
            name: "雅雯",
            age: 4,
            date: dayjs().format("YYYY-MM-DD HH:mm:ss"),
        },
    ];
    res.send(result);
});

App.listen(5001, () => {
    console.log("5001服务器启动了");
});
